﻿using System;
using System.Linq;
using System.Configuration;

namespace NetSurveillance.WebApp.Utilities
{
    public class PresetValues
    {
        public static string DefaultLang
        {
            get { return ConfigurationManager.AppSettings["DefaultLang"]; }
        }

        public static string DefaultConnection
        {
            get { return ConfigurationManager.ConnectionStrings["WebAppDataService"].ConnectionString; }
        }

        public static int MonitorPort
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["MonitorPort"]); }
        }

        public static string MonitorIp
        {
            get { return ConfigurationManager.AppSettings["MonitorIp"]; }
        }

        public static int ListenPort
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["ListenPort"]); }
        }

        public static string PcapSavePath
        {
            get { return ConfigurationManager.AppSettings["PcapSavePath"]; }
        }

        public static string NetWorkCardName
        {
            get
            {
                return ConfigurationManager.AppSettings.AllKeys.Contains("NetWorkCardName")
                           ? ConfigurationManager.AppSettings["NetWorkCardName"]
                           : "eth0";
            }
        }

        public struct SessionKeys
        {
            public const string CurrentUser = "CurrentUser";
            public const string UserMenu = "UserMenus";
            public const string UserAction = "UserActions";
            public const string ActPermissions = "ActionPermissions";
            public const string SetupWizard = "SetupWizard";
            public const string SetupWizardStep = "SetupWizardStep";
            public const string SetupWizardCaseId = "SetupWizardCaseId";
            public const string SetupWizardTaskName = "SetupWizardTaskName";
            public const string SetupWizardKeywords = "SetupWizardKeywords";
            public const string SearchFilter = "SearchFilter";
        }

        public struct ApplicationKeys
        {
            public const string ScanStartTime = "ScanStartTime";
            public const string CurrentCase = "CurrentCase";
            public const string CurrentTask = "CurrentTask";
            public const string PageSize = "PageSize";
            public const string SetTaskStatusTime = "SetTaskStatusTime";
            public const string TaskStatus = "TaskStatus";
            public const string IsShowNoTitleRecord = "ShowNoTitleRecord";
            public const string HostScanTime = "HostScanTime";
            public const string GetAdslTime = "GetAdslTime";
            public const string SetAdslTime = "SetAdslTime";
            public const string SetSvrIpTime = "SetSvrIpTime";
            public const string SetRmSvrTime = "SetRmSvrTime";
        }

        public struct InteractiveKeys
        {
            public const string ServerIpScanning = "Interactive_ServerIpScanning";
            public const string HostScanning = "Interactive_HostScanning";
            public const string SetTaskStatus = "Interactive_SetTaskStatus";
            public const string GetAdsl = "Interactive_GetAdsl";
            public const string SetAdsl = "Interactive_SetAdsl";
            public const string SetSvrIp = "Interactive_SetSvrIp";
            public const string SetRmSvr = "Interactive_SetRmSvr";
        }

        public struct TempDataKeys
        {
            public const string ErrorMessage = "ErrorMessage";
        }

        public const int DefaultPageSize = 10;

        /// <summary>
        /// 超时时间（单位：秒）
        /// </summary>
        public struct Timeouts
        {
            /// <summary>
            /// 主机扫描超时时间
            /// </summary>
            public const int HostScan = 300;

            public const int SetTaskStatus = 30;

            /// <summary>
            /// 获取监控机IP超时时间
            /// </summary>
            public const int ScanServerIp = 60;

            public const int GetAdsl = 15;

            public const int SetAdsl = 15;

            public const int SetSvrIp = 30;

            public const int SetRmSvr = 30;
        }
    }
}